﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel;
using System.Data.Linq.Mapping;

namespace JsonTest1.DatabaseFramwork
{
    [Table]
    public class MyTable : INotifyPropertyChanged, INotifyPropertyChanging
    {
        private int _index;
        [Column(IsPrimaryKey = true, CanBeNull = false, IsDbGenerated = true, DbType = "INT NOT NULL Identity", AutoSync = AutoSync.OnInsert)]
        public int Index
        {
            get { return _index; }
            set {
                if (_index != value)
                {
                   NotifyPropertyChanging("Index");
                   _index=value;
                   NotifyPropertyChanged("Index");
                }
             }
        }

        private string _name;
        [Column]
        public string Name
        {
            get{return _name;}
            set{
                NotifyPropertyChanging("Name");
                _name=value;
                NotifyPropertyChanged("Name");
            }
        }



#region INotifyPropertyChanged Members

public event PropertyChangedEventHandler PropertyChanged;

private void NotifyPropertyChanged(string propertyName)

{

if (PropertyChanged != null)

{

PropertyChanged(this, new PropertyChangedEventArgs(propertyName));

}

}

#endregion



#region INotifyPropertyChanging Members

public event PropertyChangingEventHandler PropertyChanging;

private void NotifyPropertyChanging(string propertyName)

{

if (PropertyChanging != null)

{

PropertyChanging(this, new PropertyChangingEventArgs(propertyName));

}

}

#endregion

}

    
}
